<?php require_once("common/doctype.html"); ?>
<html>
<head>
<?php require_once("common/common_head.html"); ?>
<link rel="stylesheet" type="text/css" href="css/edit.css">
<script type="text/javascript" src="js/edit.js"></script>
</head>
<body>
<?php require_once("common/header.html"); ?>
<hr>

<?php require_once("common/status.html"); ?>

<div id="content">
	<form name="edit_form" method="post" action="index.php" id="edit-form">
	<div id="edit-main-content">
		<div id="info-field" class="field2">
			<div class="field-inner">
				<table>
					<tr>
						<td class="field-info-item"><?php print(REGAP_STRING_EDIT_INFO_ITEM_PATH.":"); ?></td>
						<td class="field-info-value">
							<?php print('<a href="'.REGAP_URL.substr($data['path'],1).'">'.$data['path'].'</a>'); ?>
							<input type="hidden" name="path" value="<?php print($data['path']); ?>">
						</td>
					</tr>
					<tr>
						<td class="field-info-edit-icon" align="right"><a href="javascript:void(0);" class="parts-edit-icon"><img src="img/edit.gif"/></a></td>	
						<td class="field-info-edit-value"><?php print('<input type="text" name="path-new" value="'.$data['path'].'" size="'.REGAP_EDIT_INFO_PATH_SIZE.'" disabled>'); ?></td>
					</tr>
					<tr>
						<td class="field-info-item"><?php print(REGAP_STRING_EDIT_INFO_ITEM_TEMPLATE.":"); ?></td>
						<td class="field-info-value">
							<?php print($data['template_name']); ?>
							<input type="hidden" name="template_name" value="<?php print($data['template_name']); ?>">
							<input type="hidden" name="template_path" value="<?php print($data['template_path']); ?>">
						</td>
					</tr>
					<tr>
						<td class="field-info-edit-icon" align="right"><a href="javascript:void(0);" class="parts-edit-icon"><img src="img/edit.gif"/></a></td>
						<td class="field-info-edit-value">
							<?php
								print('<select name="template-new" disabled>');
								foreach($data['templates'] as $val) {
									print('<option value="'.$val['template_path'].'">');
									print($val['template_name']);
									print('</option>');
								}
								print('</select>');
							?>
						</td>
						<td>
							<?php print('<input type="button" value="'.REGAP_STRING_EDIT_INFO_VALUE.'" id="info-field-value" disabled>'); ?>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<fieldset id="contents-field">
			<legend class="field-title"><?php print(REGAP_STRING_EDIT_CONTENTS_FIELD_TITLE); ?></legend>
			<link rel="stylesheet" type="text/css" href="css/edit/style.css">
			<div class="field-inner" id="contents">
				<?php
					if(!empty($data['edit_template_path'])) {
						include(EDITTEMPLATEDIR.$data['edit_template_path']);
					}
				?>
			</div>
			<input type="hidden" name="edit_contents_prefix" value="<?php print(REGAP_CONTENTS_PREFIX_NAME); ?>">
			<input type="hidden" name="edit_template_path" value="<?php print($data['edit_template_path']); ?>">
		</fieldset>
		<div id="submit-field">
			<div class="field-inner">
				<table><tr>
					<td><input type="submit" name="page_edit_check" value="<?php print(REGAP_STRING_EDIT_ACTION_CHECK_VALUE); ?>"></td>
					<td><input type="submit" name="page_edit_release" value="<?php print(REGAP_STRING_EDIT_ACTION_RELEASE_VALUE); ?>"></td>
					<td><input type="submit" name="page_edit_save" value="<?php print(REGAP_STRING_EDIT_ACTION_SAVE_VALUE); ?>"></td>
					<td><input type="submit" name="page_edit_delete" value="<?php print(REGAP_STRING_EDIT_ACTION_DELETE_VALUE); ?>"></td>
					<td><input type="submit" name="page_edit_remove" value="<?php print(REGAP_STRING_EDIT_ACTION_REMOVE_VALUE); ?>"></td>
				</tr></table>
			</div>
		</div>
		<input type="hidden" name="token" value="<?php print(get_token()); ?>">
	</div>
	<div id="edit-related-content">
		<fieldset id="fileupload-field">
			<legend class="field-title"><?php print(REGAP_STRING_EDIT_FILEUPLOAD_FIELD_TITLE); ?></legend>
			<div class="field-inner">
				<table>
				<tr><td class="field-info-item"><?php print(REGAP_STRING_UPLOAD_FILE_DEST_ITEM.":"); ?></td></tr>
				<tr><td><input type="text" name="dest" size="<?php print(REGAP_EDIT_UPLOAD_DEST_SIZE); ?>" value="<?php print($data['dest']); ?>"></td></tr>
				<tr><td class="field-info-item"><?php print(REGAP_STRING_UPLOAD_FILE_SRC_ITEM.":"); ?></td></tr>
				<tr><td><input name="user_file" id="fileupload-file" type="file" size="<?php print(REGAP_EDIT_UPLOAD_SRC_SIZE); ?>"></td></tr>
				<tr><td><input type="submit" id="fileupload-submit" name="page_edit_upload" value="<?php print(REGAP_STRING_UPLOAD_SUBMIT_VALUE); ?>"></td></tr>
				</table>
		       		<input type="hidden" name="action_edit_upload" value="true">
			    	<input type="hidden" name="MAX_FILE_SIZE" SIZE="<?php print(get_upload_max_filesize()); ?>">
			</div>
		</fieldset>
	</div>
	</form>
</div>

<?php require_once('common/footer.html'); ?>
</body>
</html>
